import {get, post, getStorage} from '@/common/util.js'
/*
 * 获取活动场地列表
 * size 每页返回数据多少条 (如为空,默认10条)
 * page 页码(如为空,默认第1页)
 * type 全部时为空,1是会议室,2是健身室,3是活动场地
 */
const getMeetingRoomList = (data) =>{
	return get({
		url: `app/meetingRoom/list`,
		data
	})
}

/*
 * 获取活动场地详情
 * meetingRoomId 活动场地ID
 */
const getMeetingRoomDetail = (data) =>{
	return get({
		url: `app/meetingRoom/details`,
		data
	})
}

/*
 * 获取预约列表
 * size 每页返回数据多少条 (如为空,默认10条)
 * page 页码(如为空,默认第1页)
 */
const getApplyList = (data) =>{
	data.token = getStorage("loginInfo")?.app?.token
	return post({
		url: `app/meeting/meetingRoomApplyList`,
		data
	})
}

/*
 * 获取预约详情
 * meetingRoomId 活动场地ID
 */
const getApplyDetail = (data) =>{
	return get({
		url: `app/meeting/meetingRoomApplyDetails`,
		data
	})
}

/*
 * 预约会议室
 * token token
 * meetingRoomId 会议室ID
 * startTime 开始时间
 * endTime 结束时间
 */
const orderActivitySite = (data) =>{
	data.token = getStorage("loginInfo")?.app?.token
	return post({
		url: `app/meeting/MeetingRoomApply`,
		data
	})
}


/*
 * 获取会议室已预定时间
 * meetingRoomId 活动场地ID
 * curdate 预定的日期
 * token
 */
const getOrderedTime= (data) =>{
	return get({
		url: `app/meeting/getOrderDate`,
		data
	})
}

/*
 * 取消会议
 * applyId 订单ID
 * token
 */
const cancelOrder= (data) =>{
	data.token = getStorage("loginInfo")?.app?.token
	return post({
		url: `app/meeting/cancelOrder`,
		data
	})
}

/*
 * 会议室加时
 * applyId 订单ID
 * token
 */
const checkOvertime= (data) =>{
	return get({
		url: `app/meeting/getOvertime`,
		data
	})
}


export default{
	getApplyList,
	getApplyDetail,
	getMeetingRoomList,
	getMeetingRoomDetail,
	orderActivitySite,
	getOrderedTime,
	cancelOrder,
	checkOvertime
}